#ifndef __RTSP_H264LIVESMS_H_
#define __RTSP_H264LIVESMS_H_



#include "liveMedia.hh"
#include "BasicUsageEnvironment.hh"
#include "GroupsockHelper.hh"

#include "OnDemandServerMediaSubsession.hh"
#include <sys/ipc.h> //ipc
#include <sys/shm.h>
#include "rtsp_h264liveSource.h"
#include "rtsp.h"

#define SHM_KEY_ID 8008


class rtsp_h264liveSMS : public OnDemandServerMediaSubsession
{
public:
	rtsp_h264liveSMS(UsageEnvironment & env, FramedSource * source, CRingBuffer<VidPacket> *ringbuffer);
	~rtsp_h264liveSMS(void);

public:
	virtual char const * getAuxSDPLine(RTPSink * rtpSink, FramedSource * inputSource);
	virtual FramedSource * createNewStreamSource(unsigned clientSessionId, unsigned & estBitrate); // "estBitrate" is the stream's estimated bitrate, in kbps
	virtual RTPSink * createNewRTPSink(Groupsock * rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource * inputSource);

	static rtsp_h264liveSMS * createNew(UsageEnvironment & env, FramedSource * source, CRingBuffer<VidPacket> *ringbuffer);

	static void afterPlayingDummy(void * ptr);

	static void chkForAuxSDPLine(void * ptr);
	void chkForAuxSDPLine1();

private:
	FramedSource * m_pSource;
	char * m_pSDPLine;
	RTPSink * m_pDummyRTPSink;
	char m_done;
	CRingBuffer<VidPacket> *m_ringBuffer;
};


#endif